package com.example.prom.dangwen.y2023.basic;

import lombok.Data;
import lombok.ToString;

import java.util.ArrayList;
import java.util.Objects;

@Data
@ToString(callSuper = true)
public class Son extends Father{
    private String age;
    private static Object obj = new Object();

    public static void main(String[] args) {
        final Son son = new Son();
        son.setName("sonA");
        System.out.println(son);
        son.setAge("1");
        System.out.println(son);
        StringBuffer sb = new StringBuffer();
        try {
            synchronized (obj){
                obj.wait();
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        } finally {
            System.out.println("1");
        }
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        Son son = (Son) o;
        return Objects.equals(age, son.age);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), age);
    }
}
